package com.ncmmall.application.jobs;

import com.ncmmall.application.business.coupon.CouponApplication;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * 优惠券过期定时任务
 *
 * @author likaikai
 * @date 2021-1-31 16:27:57
 */
@Slf4j
public class AutoCouponApplication extends QuartzJobBean {

    private final CouponApplication couponApplication;

    public AutoCouponApplication(CouponApplication couponApplication) {
        this.couponApplication = couponApplication;
    }

    public void execute() {
        try {
            log.info("[优惠券过期作业调度启动]");
            couponApplication.autoCoupon();
            log.info("[优惠券过期作业调度完成]");
        } catch (Exception e) {
            log.error("[优惠券过期作业调度作业调度异常]", e);
        }
    }

    @Override
    protected void executeInternal(JobExecutionContext context) {

    }

}
